def main():
    v = [2023] * 10
    i = 1
    while True:
        words = list(str(i))
        for word in map(int, words):
            if v[word] <= 0:
                print(i)
                return
            v[word] -= 1
        i += 1


main()
